#!/bin/bash
# Simple launcher script for Ollama Translator

# Check if Ollama is running
if ! pgrep -x "ollama" > /dev/null; then
    echo "⚠️  Ollama service is not running"
    echo "Please start Ollama with:"
    echo "  systemctl --user start ollama"
    echo "  or"
    echo "  ollama serve"
    echo ""
    read -p "Do you want to continue anyway? (y/N) " -n 1 -r
    echo
    if [[ ! $REPLY =~ ^[Yy]$ ]]; then
        exit 1
    fi
fi

# Check if executable exists
if [ -f "dist/ollama_translate" ]; then
    echo "🚀 Starting Ollama Translator..."
    ./dist/ollama_translate
elif [ -f "ollama_translate" ]; then
    echo "🚀 Starting Ollama Translator..."
    ./ollama_translate
else
    echo "❌ Executable not found!"
    echo "Please build the application first:"
    echo "  python pyinstaller_build.py"
    exit 1
fi